package me.ereach.oop;

import org.junit.Test;

public class MyTest {
    @Test
    public void testCast() {
        int a = 10;
        short b = (short) a;
        System.out.println(a);
        System.out.println(b);
    }

    @Test
    public void testPolymorphism() {
        Point[] points = {
                new Point(2, 3),
                new Circle(7),
                new Point(5, 7),
                new Circle(11, 13, 9)
        };

        for (Point x : points)
            System.out.println(x);
    }

    @Test
    public void testCircle() {
        Circle c1 = new Circle(7);
        System.out.println(c1);
        System.out.println(c1.getArea());
        System.out.println(c1.getPerimeter());

        Circle c2 = new Circle(3, 7, 5);
        System.out.println(c2);
        System.out.println(c2.getArea());
        System.out.println(c2.getPerimeter());

        System.out.println(c1.getDistance(c2));
    }

    @Test
    public void testTriangle() {
        Point p1 = new Point(2, 3);
        Point p2 = new Point(11, 5);
        Point p3 = new Point(7, 13);
        Triangle t1 = new Triangle(p1, p2, p3);
        System.out.println(t1);
        System.out.println(t1.getArea());
        System.out.println(t1.getPerimeter());
    }

    @Test
    public void testRefObjects() {
        Circle circle1 = new Circle(3);
        Circle circle2 = new Circle(3);
        Circle circle3 = circle1;

        System.out.println(circle1);
        System.out.println(circle2);
        System.out.println(circle3);

        System.out.println(circle1 == circle2);
        System.out.println(circle1 == circle3);
    }

    @Test
    public void testMyUtils() {
        System.out.println(MyUtils.getCircleArea(7));
        System.out.println(MyUtils.getCirclePerimeter(7));
    }
}
